# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python2-libkeepass
pkgname=('python2-libkeepass' 'python-libkeepass')
_pkgname=libkeepass
pkgver=0.3.1.post1
pkgrel=8
pkgdesc='A library to access KeePass 1.x/KeePassX (v3) and KeePass 2.x (v4) files.'
arch=('any')
url='https://pypi.org/project/libkeepass/'
license=('GPL')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('b9fa0c87ea33a9bcd7c5e138c1eff3809e46a196970580960a725afe5b51db124ad9aa26d3e7b462bd5de5d5e6e679edc6e3301b9702a95678365bec271d533f')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-libkeepass() {
  depends=('python2' 'python2-lxml' 'python2-pycryptodome' 'python2-colorama')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-libkeepass() {
  depends=('python' 'python-lxml' 'python-pycryptodome' 'python-colorama')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

